//% color="#4169E1" iconWidth=50 iconHeight=40
namespace phv2{

    //% block="PH计V2[OBJ]初始化 引脚[PIN]" blockType="command" 
    //% OBJ.shadow="normal" OBJ.defl="ph21"
    //% PIN.shadow="normal" PIN.defl="pin1"
    export function AnalogVoltageInit(parameter: any, block: any) {
        let obj=parameter.OBJ.code;
        let pin=parameter.PIN.code;
        Generator.addImport("from pinpong.libs.dfrobot_ph import PH2");
        Generator.addCode(`${obj} = PH2(${pin})`);
   
    }


    //% block="[OBJ]读取ph值" blockType="reporter"  
    //% OBJ.shadow="normal" OBJ.defl="ph21"
    export function AnalogVoltage_read_data(parameter: any, block: any) { 
        let obj=parameter.OBJ.code;
        Generator.addCode( [`${obj}.read_ph()`,Generator.ORDER_UNARY_POSTFIX]);
   
   }

   
}